package com.bw.shop_2302

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.lifecycle.lifecycleScope
import com.alibaba.android.arouter.launcher.ARouter
import com.bw.base.mvvm.BaseViewActivity
import com.bw.shop_2302.databinding.ActivityWelBinding
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

//欢迎页(倒计时结束后判断是否进行了登录 ，登录跳转到主页，未登录跳转到登录界面)
//无登录拦截器
//有登录拦截器 (跳转到主页)
class WelActivity : BaseViewActivity<ActivityWelBinding>() {

    override fun initView() {

        lifecycleScope.launch {

            for (i in 5 downTo  1){
                delay(1000)
                binding.djs.text=" $i 秒"
                if(i==1){
                    ARouter.getInstance().build("/app/ShopActivity").navigation()
                }
            }

        }

        binding.djs.setOnClickListener {

            finish() //生命周期结束，协程自动结束
            ARouter.getInstance().build("/app/ShopActivity").navigation()
        }

    }

    override fun initData() {

    }

    override fun getLayoutID(): Int = R.layout.activity_wel


}